package com.gzy.mylog.modules.mine;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;

import com.gzy.mylog.BaseActivity;
import com.gzy.mylog.LoginActivity;
import com.gzy.mylog.R;
import com.gzy.mylog.events.LogoutEvent;
import com.gzy.mylog.manager.AuthManager;

import org.greenrobot.eventbus.EventBus;

public class SettingsActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        findViewById(R.id.rl_back).setOnClickListener(v ->{
            finish();
        });
        findViewById(R.id.btn_logout).setOnClickListener(v ->{
            AuthManager.logout(this);
            startActivity(new Intent(this,LoginActivity.class));

            runOnUiThread(()->{
                finish();

                EventBus.getDefault().post(new LogoutEvent());

            },200);
        });
    }
}
